<template>
  <div>
    <!-- 搜索表单 -->
    <el-form :inline="true" class="search-component">
      <el-form-item :label="searchName+(isName?'名':'内容')">
        <el-input v-model="searchCondition.keyWord" :placeholder="'请输入'+searchName+(isName?'名':'内容')" clearable />
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="searchCondition.createTime"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          align="right"
        />
      </el-form-item>
      <el-button type="primary" icon="el-icon-search" size="medium" @click="search">搜索</el-button>
      <el-button type="warning" icon="el-icon-refresh" size="medium" @click="reset">重置</el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    searchName: {
      type: String,
      default: ''
    },
    isName: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      searchCondition: {
        createTime: [], // 创建时间数组
        keyWord: ''// 关键字
      }}
  },
  methods: {
    search() {
      this.$emit('search', this.searchCondition)
    }
  }
}
</script>

<style scoped>

</style>
